/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author KNO
 */
@Entity
@Table(name = "contrasenas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contrasenas.findAll", query = "SELECT c FROM Contrasenas c"),
    @NamedQuery(name = "Contrasenas.findByContPw", query = "SELECT c FROM Contrasenas c WHERE c.contPw = :contPw"),
    @NamedQuery(name = "Contrasenas.findByContUser", query = "SELECT c FROM Contrasenas c WHERE c.contUser = :contUser")})
public class Contrasenas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "cont_pw")
    private String contPw;
    @Id
    @Basic(optional = false)
    @Column(name = "cont_user")
    private String contUser;
    @JoinColumn(name = "cont_idestudiante", referencedColumnName = "est_id")
    @ManyToOne
    private Estudiante contIdestudiante;

    public Contrasenas() {
    }

    public Contrasenas(String contUser) {
        this.contUser = contUser;
    }

    public String getContPw() {
        return contPw;
    }

    public void setContPw(String contPw) {
        this.contPw = contPw;
    }

    public String getContUser() {
        return contUser;
    }

    public void setContUser(String contUser) {
        this.contUser = contUser;
    }

    public Estudiante getContIdestudiante() {
        return contIdestudiante;
    }

    public void setContIdestudiante(Estudiante contIdestudiante) {
        this.contIdestudiante = contIdestudiante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (contUser != null ? contUser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contrasenas)) {
            return false;
        }
        Contrasenas other = (Contrasenas) object;
        if ((this.contUser == null && other.contUser != null) || (this.contUser != null && !this.contUser.equals(other.contUser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Contrasenas[ contUser=" + contUser + " ]";
    }
    
}
